package com.zhuojy.equity.mall.admin.manager.struct;


import com.zhuojy.equity.mall.admin.common.constant.Constants;
import com.zhuojy.equity.mall.admin.dal.dataobject.TUserDO;
import com.zhuojy.equity.mall.admin.manager.bo.RegisterBO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingConstants;
import org.mapstruct.ReportingPolicy;

/**
 * 用户注册接口业务对象转换映射器
 */
@Mapper(componentModel = MappingConstants.ComponentModel.SPRING, unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface RegisterDoStruct {

	/**
	 * 将 RegisterBO 对象转换为 TUserDO
	 */
	@Mapping(target = "state", constant = Constants.OPEN)
	@Mapping(target = "createdAt", expression = "java(new java.util.Date())")
	@Mapping(target = "createdBy", defaultValue = "SYSTEM")
	@Mapping(target = "updatedAt", expression = "java(new java.util.Date())")
	@Mapping(target = "updatedBy", defaultValue = "SYSTEM")
	TUserDO toDO(RegisterBO registerBO);
}
